package com.dnjn.mes.biz.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

import com.dnjn.mes.biz.domain.MesWorkforceShift;
import com.dnjn.mes.biz.domain.MesWorkforceXref;
import com.dnjn.mes.biz.service.IMesWorkforceShiftService;
import com.dnjn.mes.biz.service.IMesWorkforceXrefService;
import com.dnjn.mes.biz.websocket.WebSocketServer;
import com.dnjn.mes.common.core.domain.AjaxResult;
import com.dnjn.mes.common.core.domain.entity.SysUser;
import com.dnjn.mes.common.utils.DateUtils;
import com.dnjn.mes.common.utils.StringUtils;
import com.dnjn.mes.common.utils.poi.ExcelUtil;
import com.dnjn.mes.framework.web.service.SysLoginService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.Assert;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import io.swagger.v3.oas.annotations.tags.Tag;

import javax.servlet.http.HttpServletResponse;
import javax.websocket.EncodeException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Objects;

import com.dnjn.mes.common.core.controller.BaseController;

import com.dnjn.mes.biz.service.IMesWorkforceShiftClockingService;
import com.dnjn.mes.biz.domain.MesWorkforceShiftClocking;

/**
 * <p>
 * 打卡记录 前端控制器
 * </p>
 *
 * @author Amber
 * @since 2023-08-29
 */
@Tag(name = "MesWorkforceShiftClocking 打卡记录", description = "打卡记录")
@RestController
@RequestMapping("/biz/clocking")
public class MesWorkforceShiftClockingController extends BaseController {

    @Autowired
    protected IMesWorkforceShiftClockingService baseService;

    @Autowired
    protected IMesWorkforceXrefService workforceXrefService;

    @Autowired
    private IMesWorkforceShiftService shiftService;
    @Autowired
    private SysLoginService loginService;


    /**
     * 数据统计->打卡记录
     */
    @Operation(summary = "打卡记录", tags = {"数据统计"})
    @PostMapping("/page")
    public AjaxResult page(@RequestParam(defaultValue = "1") Integer current,
                           @RequestParam(defaultValue = "10") Integer size,
                           @RequestParam(required = false) @Parameter(description = "取值范围 (0或1)") String hasClockin, @RequestHeader(value = "equipmentId") long equipmentId) {
        PageHelper.startPage(current, size);
        List<MesWorkforceShiftClocking> list = baseService.clockInRecords(hasClockin, equipmentId);
        PageInfo pageInfo = new PageInfo(list);
        return success(pageInfo);
    }

   /* @PostMapping("/export")
    public void export(HttpServletResponse response, MesWorkforceShiftClocking domain) {
        List<MesWorkforceShiftClocking> list = baseService.list(Wrappers.query(domain));
        ExcelUtil<MesWorkforceShiftClocking> util = new ExcelUtil<MesWorkforceShiftClocking>(MesWorkforceShiftClocking.class);
        util.exportExcel(response, list, "参数数据");
    }
*/




}